package com.example.mobile2021606144ywr0415;

import android.os.Bundle;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

public class MainActivity extends AppCompatActivity {
    private RecyclerView rvMainPeople;
    String[] names = {"张三", "李四", "王五", "陈六", "丁七","张伟","朱玉贵"};
    private TextView tvMainTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        rvMainPeople.setLayoutManager(new LinearLayoutManager(this));
        peopleAdapter adapter=new peopleAdapter(names);
        rvMainPeople.setAdapter(adapter);
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tv_main_title);
        rvMainPeople=(RecyclerView)findViewById(R.id.rv_main_people);
    }
}